using System;

namespace IssueIT.Core
{
	public static class SystemTime
	{
		private static Func<DateTime> _now;
		private static Func<DateTime> _utcNow;

		static SystemTime()
		{
			Reset();
		}

		public static void Reset()
		{
			_now = () => DateTime.Now;
			_utcNow = () => DateTime.UtcNow;
		}

		public static DateTime Now
		{
			get
			{
				return _now();
			}
		}

		public static DateTime UtcNow
		{
			get
			{
				return _utcNow();
			}
		}

		public static void SetNow(Func<DateTime> now)
		{
			_now = now;
		}

		public static void SetUtcNow(Func<DateTime> utcNow)
		{
			_utcNow = utcNow;
		}
	}
}